/* Exercise 5.25
   ejer5_25.c */
#include <stdio.h>

float getMinimum( float n1, float n2, float n3 );

/* function main begins program execution */
int main( void )
{
    float n1, n2, n3;

    printf( "Enter a number: " );
    scanf( "%f", &n1 );
    printf( "Enter a number: " );
    scanf( "%f", &n2 );
    printf( "Enter a number: " );
    scanf( "%f", &n3 );

    printf( "The smallest number is: %.2f\n", getMinimum( n1, n2, n3 ));
    return 0; /* indicate that program ended successfully */
} /* end function main */

float getMinimum( float n1, float n2, float n3 )
{
    if ( n1 < n2 && n1 < n3 )
        return n1;
    else
        if ( n2 < n1 && n2 < n3 )
            return n2;
        else
            return n3;
}
